package com.xqls.service.impl;

import java.util.List;
import java.util.Map;

import com.xqls.bean.FluggasDischargeRealdataBean;
import com.xqls.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xqls.dal.dao.FluggasDischargeRealdataDao;
import com.xqls.dal.model.FluggasDischargeRealdata;
import com.xqls.dal.model.FluggasDischargeRealdataExample;
import com.xqls.dal.model.FluggasDischargeRealdataExample.Criteria;
import com.xqls.service.FluggasDischargeRealdataService;

@Service
public class FluggasDischargeRealdataServiceImpl implements FluggasDischargeRealdataService {

	@Autowired private FluggasDischargeRealdataDao realdataDao;
	
	@Override
	public boolean insertRealdata(FluggasDischargeRealdataBean bean) {
		FluggasDischargeRealdata realdata=(FluggasDischargeRealdata) ObjectUtil.transfer(bean, FluggasDischargeRealdata.class);
		return realdataDao.insertRealdata(realdata);
	}

	@Override
	public boolean updateRealdata(FluggasDischargeRealdataBean bean) {
		FluggasDischargeRealdata realdata=(FluggasDischargeRealdata) ObjectUtil.transfer(bean, FluggasDischargeRealdata.class);
		return this.realdataDao.updateRealdata(realdata);
	}

	@Override
	public int getRealdataCountByRecord(FluggasDischargeRealdata record) {
		FluggasDischargeRealdataExample example=new FluggasDischargeRealdataExample();
		Criteria criteria = example.createCriteria();
		criteria.andRealdataNoEqualTo(record.getRealdataNo());
		
		return this.realdataDao.getRealdataCountByExample(example);
	}

	@Override
	public List<Map<String,Object>> getListAll() {
		return this.realdataDao.getListAll();
	}

	@Override
	public List<Map<String, Object>> selectByMap(Map<String, Object> map) {
		return realdataDao.selectByMap(map);
	}

	@Override
	public FluggasDischargeRealdataBean selectBydeviceNo(String deviceNo) {
		return (FluggasDischargeRealdataBean) ObjectUtil.transfer(realdataDao.selectBydeviceNo(deviceNo), FluggasDischargeRealdataBean.class);
	}

	@Override
	public List<FluggasDischargeRealdata> selectFluggas() {
		return realdataDao.selectFluggas();
	}

	@Override
	public List<FluggasDischargeRealdata> getListByDeviceNo(String deviceNo) {
		FluggasDischargeRealdataExample example=new FluggasDischargeRealdataExample();
		Criteria criteria = example.createCriteria();
		criteria.andDeviceNoEqualTo(deviceNo);
		
		return this.realdataDao.getListByExample(example);
	}

}
